import VueX from 'vuex';
import Vue from 'vue';
import infoPool from './vm_infomgr';
import SoftwareSettings from './vm_setting';
import vmDataManager from './vm_datamanager';
import vmLogging from './vm_logging';
import vmMessageBus from './vm_messagebus';

Vue.use(VueX);

export default new VueX.Store({
    state: {
        currentSelect_vm_id: undefined,
        aboutSoftware_display: false,
        aboutSoftware_update: false,
        inputOutput_display: false
    },
    mutations: {
        change_currentSelect_vm_id(state, id) {
            state.currentSelect_vm_id = id;
        },
        aboutSoftware_Controls(state, operate) {
            switch (String(operate).toLowerCase()) {
                case "open":
                    state.aboutSoftware_display = true;
                    state.aboutSoftware_update = false;
                    break;
                case "close":
                    state.aboutSoftware_display = false;
                    state.aboutSoftware_update = false
                    break;
                case "update":
                    state.aboutSoftware_update = true;
                    state.aboutSoftware_display = true;
                    break;
            }
        },
        inputOutput_Controls(state, operate) {
            state.inputOutput_display = operate;
        }
    },
    modules: {
        infoPool,
        SoftwareSettings,
        vmDataManager,
        vmLogging,
        vmMessageBus
    }
});
